//index.js
//获取应用实例
var server = require('../../utils/server');
const app = getApp()

Page({
   web_url:"",
    data: {
      title: '中山市恒力健身馆',
      url:'',
      web_src:''
    },
  
  onLoad: function () {
    var that = this;
    var app = getApp();
    var that = app;
    
    /*server.getJSON("/Index/get_pay_config",function(res){
        that.globalData.pay_config = res;
     });*/
  },
  
   
    onShareAppMessage(options) {
      var that = this
      var return_url = options.webViewUrl
      var path = '/pages/index/index?return_url=' + encodeURIComponent(return_url)
      return {
        title: that.data.title,
        path: path,
        success: function (res) {
          that.web_url = return_url
          // 转发成功
          wx.showToast({
            title: "转发成功",
            icon: 'success',
            duration: 2000
          })
        },
        fail: function (res) {
          // 转发失败
        }
      }
    },
    onLoad: function () {
        var pages=getCurrentPages();
        var currentPage = pages[pages.length - 1]; 
        var web_src = decodeURIComponent(currentPage.options.return_url ||
        encodeURIComponent("https://www.hengli118.com"))
        this.web_url = web_src
        this.setData({
          web_src: web_src
        }, function () {

        });

    }
 
  
})
